// pages/add/add.js
const db = wx.cloud.database()
const productsCollection = db.collection('products')
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  addData:function(event){
     console.log(event)
     productsCollection.add({
       data:{
         title:"product 2",
         image:"https://res.wx.qq.com/wxdoc/dist/assets/img/0.4cb08bb4.jpg",
         tags:["tag1","tag2"],
         price:120.12,
         color:'blue'
       },
       success:res =>{
         console.log(res)
       }
     })
  }

})